import request from '@/utils/request'

export function send(data) {
  return request({
    url: '/vue-admin-template/user/mapservice/',
    method: 'post',
    data: data
  })
}

export function sendCB(data) {
  // 取出并处理数据
  return data.lat_lng
}

export function save2file(data, name) {
  try {
    const blobUrl = window.URL.createObjectURL(data)
    const a = document.createElement('a')
    a.style.display = 'none'
    a.download = name
    a.href = blobUrl
    a.click()
  } catch (e) {
    alert('保存出错')
  }
}

export function download() {
  return request({
    url: '/vue-admin-template/user/mapservice/download/',
    method: 'post',
    responseType: 'blob',
    data: 'download'
  })
}
